<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
	   xmlns:util="http://www.springframework.org/schema/util"
	   xmlns:mvc="http://www.springframework.org/schema/mvc"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

	<!--增加本地和base-service扫描路径-->
	<context:component-scan base-package="com.uc.training" use-default-filters="false">
		<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
	</context:component-scan>

	<mvc:annotation-driven>
		<mvc:message-converters>
			<!--<bean class="com.ycc.base.framework.web.spring.ResultMappingJackson2HttpMessageConverter"/>-->
			<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
			<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
		</mvc:message-converters>
	</mvc:annotation-driven>

	<!--<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>

    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>

    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
        <property name="messageConverters">
            <list>
                <bean class="com.ycc.base.framework.web.spring.ResultMappingJackson2HttpMessageConverter"/>
                   <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
            </list>
        </property>
    </bean>-->

	<!-- Bean名称视图解析器 -->
	<bean id="beanNameViewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver" />

	<!-- 定义JSP文件的位置 -->
	<!--<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/view/"/>
        <property name="suffix" value=".jsp"/>
    </bean>-->

	<!-- 登录处理 -->
	<bean class="com.ycc.base.framework.web.login.LoginContext">
		<!-- 这个配置可以模拟已登录用户(仅在maven dev模式下)
		<property name="testLoginSessionVo">
			<bean class="com.ycc.base.framework.web.login.LoginSessionVo">
				<property name="id" value="1" />
			</bean>
		</property>
		-->
	</bean>

	<!-- 拦截器 -->
	<mvc:interceptors>
		<mvc:interceptor>
			<!-- 匹配的是url路径， 如果不配置或/**,将拦截所有的Controller -->
			<mvc:mapping path="/api/**" />
			<mvc:mapping path="/admin/**"/>
			<bean class="com.uc.training.common.interceptor.TokenInterceptor"></bean>
		</mvc:interceptor>
		<!-- 当设置多个拦截器时，先按顺序调用preHandle方法，然后逆序调用每个拦截器的postHandle和afterCompletion方法 -->
	</mvc:interceptors>
	<!-- 拦截器 -->
	<!--<mvc:interceptors>
		<bean class="com.ycc.base.framework.web.spring.YccHandlerInterceptor">
			<property name="noSecurityUrls">
				<set>
					<value>/remoteHessian.do_</value>
 					<value>/demo/**</value>
					<value>/api/**</value>
				</set>
			</property>
		</bean>
	</mvc:interceptors>-->

	<!-- 异常处理器 -->
	<!--<bean id="exceptionResolver" class="com.ycc.base.framework.web.spring.YccHandlerExceptionResolver"/>-->
	<bean id="exceptionResolver" class="com.uc.training.common.handler.YccHandlerExceptionResolver"/>

	<bean id="multipartResolver"
		  class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<!--10*1024*1024 限制上传文件大小10M-->
		<property name="maxUploadSize" value="10485760"/>
		<!--resolveLazily属性启用是为了推迟文件解析，以便在UploadAction 中捕获文件大小异常-->
		<property name="resolveLazily" value="true"/>
	</bean>

</beans>
